package com.china08.yxyapi.service.yxweike;

import java.util.List;

import org.elasticsearch.index.query.BoolQueryBuilder;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import com.china08.yxyapi.cache.annotations.YxCacheConfig;
import com.china08.yxyapi.entity.es.ElasticYxyResResource;
import com.china08.yxyapi.security.profile.YxyProfile;

@YxCacheConfig
public interface YxyWeikeService {

    /**
     * 首页精品微课--已上架
     */
    @Cacheable
    public List<ElasticYxyResResource> findTop8Resources(String areaId);

    /**
     * 查询区域微课--已上架
     */
    public Page<ElasticYxyResResource> findResourceEdu(String stage, String subject, String knowId, String areaId,
            String keyword, Boolean falg, String bookId, String contentId, Pageable pageable);

    /**
     * 查询学校微课 --已上架
     */
    public Page<ElasticYxyResResource> findResourceSch(String stage, String subject, String knowId, String schoolId,
            String keyword, Boolean falg, String bookId, String contentId, Pageable pageable);

    /**
     * 查询云校微课--已上架
     */
    public Page<ElasticYxyResResource> findResourceYx(String stage, String subject, String knowId, String keyword,
            Boolean falg, String bookId, String contentId, Integer flag, Integer type, Pageable pageable);

    /**
     * 查询微课详情
     */
    public ElasticYxyResResource findOneResource(String weikeid);

    /**
     * 查询我的微课---我上传的
     */
    public Page<ElasticYxyResResource> findMyWeike(String stage, String subject, Integer viewScope, Integer status,
            String keyword, String userId, Pageable pageable);

    // public Page<ElasticYxyResResource> findMyWeike1(String stage, String
    // subject, Integer viewScope, Integer status,
    // String keyword, String userId, Pageable pageable);
    //
    // public Page<ElasticYxyResResource> findMyWeike2(String stage, String
    // subject, Integer viewScope, Integer status,
    // String keyword, String userId, Pageable pageable);

    /**
     * 删除微课
     */
    public void delete(String weikeId);

    /**
     * 查询学校微课--上架/下架/待审核/审核未通过
     */
    public Page<ElasticYxyResResource> findResourceSchUp(String stage, String subject, String schoolId, Integer status,
            String keyword, Pageable pageable);

    // public Page<ElasticYxyResResource> findResourceSchUp1(String stage,
    // String subject, String schoolId, Integer status,
    // String keyword, Pageable pageable);
    //
    // public Page<ElasticYxyResResource> findResourceSchUp2(String stage,
    // String subject, String schoolId, Integer status,
    // String keyword, Pageable pageable);

    /**
     * 审核微课/下架微课
     * 
     */
    public void audit(String weikeId, Integer status, String remark, YxyProfile yxyProfile);

    /**
     * 
     * 待审核数量---教育局
     */
    public long auditCountEdu(YxyProfile yxyProfile);

    /**
     * 查询教育局微课--上架/下架/待审核/审核未通过
     */
    public Page<ElasticYxyResResource> findResourceEduUp(String stage, String subject, YxyProfile yxyProfile,
            Integer status, String keyword, Pageable pageable);

    // public Page<ElasticYxyResResource> findResourceEduUp1(String stage,
    // String subject, YxyProfile yxyProfile,
    // Integer status, String keyword, Pageable pageable);
    //
    // public Page<ElasticYxyResResource> findResourceEduUp2(String stage,
    // String subject, YxyProfile yxyProfile,
    // Integer status, String keyword, Pageable pageable);

    /**
     * 
     * 待审核数量---学校
     */
    public long auditCountSch(String eduId);

    List<ElasticYxyResResource> findTop8Resources();

    /**
     * 首页精品微课不满8个时补充剩余的
     */
    List<ElasticYxyResResource> findTop8Resources(Integer size, List<String> areaWeikeIds);

    /**
     * 微课搜索拼接查询语句
     */
    public BoolQueryBuilder keyword(String keyword, Integer type, BoolQueryBuilder builder);

    /**
     * 带高亮的搜索微课
     */
    public Page<ElasticYxyResResource> getPageEs(BoolQueryBuilder maxBoolQueryBuilder, String keyword,
            Pageable pageable);

    /**
     * 非高亮的搜索微课
     */
    public Page<ElasticYxyResResource> getPageEs1(BoolQueryBuilder maxBoolQueryBuilder, String keyword,
            Pageable pageable);

}
